package current.security.login.service.impl;

//import org.apache.log4j.Logger;
//import com.current.basic.exception.LoginException;
import platform.util.Util;
import current.security.login.service.LoginValidateService;
import current.security.user.domain.User;

public abstract class DefaultLoginValidateServiceImpl implements LoginValidateService {
	
	//private Logger log = Logger.getLogger(this.getClass());
	/**
	 * 验证用户名和密码是否正确
	 */
	@Override
	public String loginValidate(User user,String username,String password,String s) throws NullPointerException {
		// TODO Auto-generated method stub
		if(user!=null){
			String db_username = user.getName();
			String db_pwssword = user.getPassword();
			if(!Util.isNull(db_username)&&!Util.isNull(db_pwssword)){
				if(!Util.isNull(username)&&!Util.isNull(password)){
					if(db_username.equals(username)&&db_pwssword.equals(password)){
						return "OK";
					}else{
						return "用户名或者密码错误！";
					}
				}else{
					return "请输入用户名或者密码！";
				}
			}else{
				return "没有此用户！";
			}
		}else{
			return "没有此用户！";
		}
	}
}
